home *** CD-ROM | disk | FTP | other *** search
/ 8bitfiles.net/archives / archives.tar / archives / compuserve-file-archive / 22 Graphics & Utilities / RLEDEC.TXT < prev    next >
Encoding:
Text File  |  2019-04-13  |  5.2 KB  |  117 lines

  1.  
  2.       RLEDEC.BAS
  3.   (c) 1985 by Chrisdos
  4.  
  5. RLEDEC.BAS is a basic program that will read a captured RLE (Run Lenght Encoded)
  6. Picture File and print it to any STANDARD printer. That is, you do not require
  7. a high resolution bit image printer to use this program. Any printer, including
  8. daisy wheels may be used. This program, being written in basic, is slow, but
  9. does a respectable job. The program operates by crunching the HI-Res data in
  10. to a LOW-RES Ascii character format that can be printed.
  11. Written for the Commodore 64, it can be modified with little trouble for
  12. other machines as there are no fancy tricks used and it is simple basic.
  13. (ie, for TRS computers, change PRINT#4 to LPRINT, etc.)
  14.  
  15. Operation:
  16. ----------
  17.  You must have a terminal program capable of doing a RAM BUFFER capture
  18. of the RLE Picture data. You ask CIS to display the picture, and open your
  19. RAM buffer and capture the data. When it is finished you save the data
  20. to your disk in ASCII format. It is this file that RLEDEC.BAS will use to
  21. build the picture. You capture the pictures you want, then log off.
  22.  You then load and run RLEDEC.BAS and you are prompted for the file name
  23. of your picture file. RLEDEC will read the information from the file, crunch
  24. it into ASCII symbols and print it to your line printer.
  25.  
  26. Perspective correction.
  27. -----------------------
  28. RLEDEC will print the picture on a 64 by 48 grid, This is  the
  29. original perspective of 256 by 192 but the line printer will space
  30. longer on the vertical axis than it does between characters on the
  31. horizontal axis. This may make the picture a little longer than it should be.
  32. If your printer supports a function to make the lines print closer together
  33. (normal is 6 Lines per inch) then set it to do so. (8 lines or better per inch.)
  34.  
  35. Grey Scale correction.
  36. ----------------------
  37. RLEDEC takes a 16 by 16 chunk of the picture and converts it to printable
  38. ASCII characters on the basis of how black each chunk should be. The chunk
  39. can have a value of 0 to 16 (the array variable A in the program) with
  40. 0 being a blank space to 16 being the darkest character you can print.
  41. The program as provided uses 8 characters (plus blank) to decode the chunk,
  42. you may need to alter the characters to suit your printer. These are lines
  43. 210 to 250 in the program. You may also wish to chage and add more lines so
  44. that all 16 values produce a different character on your printer should
  45. your printer support a wider range.
  46. As the program stands now, 0 = (blank), 1-2 = ', 3-4 = ., 5-6 = /, 7-8 = :
  47. 9-10 = %, 11-12 = $, 13-14 = # and 15-16 = *. You may wish to alter the
  48. weighting of the scale as well to produce different results in the printout.
  49.  
  50.  
  51. The following is the program RLEDEC.BAS. It is also avalible in .BIN and .IMG
  52. form in DL2 of the CBIG SIG as RLEDEC.BIN and RLEDEC.IMG.
  53.  
  54.  
  55.  If you have any questions or need help, please leave a message to SYSOP
  56. in the CBIG SIG. (GO CBIG from any ! prompt.)
  57.  
  58. Thank you -Chrisdos Cbig Sysop
  59. --------------------------------------------------------------------------------
  60. 10 rem print rle (c) 1985 by chrisdos
  61. 20 dim a(64):pc=0:c=0:rem make c=1 to reverse image
  62. 30 input"enter picture filename>";f$
  63. 40 open8,8,8,f$+",r,s":rem open disk file
  64. 50 open4,4:rem open printer
  65. 60 get#8,x$:ifx$<>chr$(27)goto60:rem check for esc code
  66. 70 get#8,x$,x$:rem skip "gh"
  67. 99 rem crunch 4 rle lines into 1 print line
  68. 100 for l = 1 to 4:for ol = 1 to 64
  69. 105 printl,ol
  70. 110 for il = 1 to 4
  71. 120 if pc=0 then gosub 500:print"*";
  72. 130 a(ol) = a(ol) + c
  73. 140 pc=pc-1
  74. 150 next:next:next
  75. 199 rem grey scale and print line.
  76. 200 for p = 1 to 64
  77. 210 if a(p)= 0 then print#4," ";:goto300
  78. 215 ifa(p)<=2 thenprint#4,"'";:goto300
  79. 220 if a(p)<=4 then print#4,".";:goto300
  80. 225 ifa(p)<=6 thenprint#4,"/";:goto300
  81. 230 if a(p)<=8 then print#4,":";:goto300
  82. 235 ifa(p)<=10thenprint#4,"%";:goto300
  83. 240 if a(p)<=12thenprint#4,"$";:goto300
  84. 245 ifa(p)<=14thenprint#4,"#";:goto300
  85. 250 if a(p)<=16thenprint#4,"*";:goto300
  86. 300 next p
  87. 310 print#4
  88. 330 for x=1to64:a(x)=0:next:rem clear array
  89. 340 goto 100
  90. 500 get#8,i$:pc=asc(i$)-32:rem read next char from file & convert
  91. 510 if st=64 goto 1000:rem end of file?
  92. 520 c=1+(c=1):rem toggle black/white
  93.     (note: May need to be changed to: 520 if c=1 then c=0 else c=1 )
  94. 530 if pc=0 goto 500:rem was zero, do again
  95. 540 return
  96. 1000 close 8:close 4:rem exit ! the end
  97. 1010 stop
  98.  
  99. Note: To make the program run a little faster, you may want to remove all the
  100. REM statements.
  101.  
  102. Note to CBterm users: CBterm Ver 4.5 displays the RLE picture to the screen
  103. and does not normally allow you to capture the RLE information in the RAM
  104. buffer. Should you wish to capture the data in CBterms buffer, you may do this:
  105.  LOAD CBTERM, but do not run it yet.
  106.  POKE 2871,255
  107.  RUN
  108.  This will disable CBterm from recieveing ESC codes, so any function that
  109. relies on ESC will not operate (Cursor positioning, graphics mode, etc.)
  110. With this poke in place, you will be able to RAM buffer capture and save
  111. the RLE info to disk, so only use the poke when you want to do so.
  112. The procedure would be to goto page CB65 and there select the picture you
  113. want to capture, just before entering the selection, clear and open your
  114. RAM buffer. (C= Z C= O) Then select the picture and the data will be 
  115. transmitted. When it stops (the bell rings) you close the buffer (C= C) and
  116. do an WRITE to disk (C= W) Save the file as Sequential and Ascii.
  117.